import i18n from '@/lang';
import { debounce } from "lodash";

export default class CommonErrorStatus {
  public 401 = debounce((res: any) => {
    location.href = "/#/pages/login/wechat";
    uni.showToast({
      title: i18n.t("common.service_error_status。401").toString(),
      duration: 2000,
      icon: "none"
    });
  });

  public 504 = debounce(() => {
    uni.showToast({
      title: i18n.t("common.service_error_status.504").toString(),
      duration: 2000,
      icon: "none"
    });
  });

  public 500 = debounce(() => {
    uni.showToast({
      title: i18n.t("common.service_error_status.500").toString(),
      duration: 2000,
      icon: "none"
    });
  });

  public default = debounce(() => {
    uni.showToast({
      title: i18n.t("common.service_error_status.default").toString(),
      duration: 2000,
      icon: "none"
    });
  });
}